home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / apps / astronmy / strchart.arc / patch.arc / moonphse.dif < prev    next >
Text File  |  1989-03-23  |  2KB  |  81 lines

  1. *** ../starchart/moonphase.c    Mon Sep 19 09:11:06 1988
  2. --- moonphse.c    Mon Sep 26 08:00:23 1988
  3. ***************
  4. *** 12,17 ****
  5. --- 12,21 ----
  6.   ! modified by awpaeth@watcgl, December 1987 for sysV compatability
  7.   ****************************************************************************/
  8.   
  9. + #ifdef ST_MWC /* Mark Williams C for the Atari ST */
  10. + #define SYSV /* MWC is almost SYSV compatible */
  11. + #endif  /* ST_MWC */
  12.   #include <stdio.h>
  13.   #ifndef SYSV
  14.   #include <sys/time.h>
  15. ***************
  16. *** 19,25 ****
  17. --- 23,35 ----
  18.   #include <time.h>
  19.   #endif
  20.   #include <math.h>
  21. + #ifdef ST_MWC
  22. + #include <osbind.h> /* Needed for Cconws() and Crawcin() */
  23. + #define cfree() free() /* MWC doesn't have cfree() */
  24. + #endif /* ST_MWC */
  25. + #ifndef PI
  26.   #define PI         3.141592654
  27. + #endif
  28.   #define EPOCH   1983
  29.   #define EPSILONg 279.103035     /* solar ecliptic long at EPOCH */
  30.   #define RHOg     282.648015     /* solar ecliptic long of perigee at EPOCH */
  31. ***************
  32. *** 34,40 ****
  33. --- 44,55 ----
  34.   double adj360();
  35.   double potm();
  36.   
  37. + #ifdef ST_MWC
  38. + extern char *getenv(); /* Used to see if we're running from the desktop */
  39. + time_t lo;
  40. + #else /* !ST_MWC */
  41.   long *lo = (long *) calloc (1, sizeof(long)); /* used by time calls */
  42. + #endif /* ST_MWC */
  43.   struct tm *pt; /* ptr to time structure */
  44.   
  45.   double days;   /* days since EPOCH */
  46. ***************
  47. *** 42,50 ****
  48. --- 57,70 ----
  49.   double phase2; /* percent of lunar surface illuminated one day later */
  50.   int i = EPOCH;
  51.   
  52. + #ifdef ST_MWC
  53. + time (&lo);  /* get system time */
  54. + pt = gmtime(&lo);  /* get ptr to gmt time struct */
  55. + #else /* !ST_MWC */
  56.   time (lo);  /* get system time */
  57.   pt = gmtime(lo);  /* get ptr to gmt time struct */
  58.   cfree(lo);
  59. + #endif /* ST_MWC */
  60.   
  61.   /* calculate days since EPOCH */
  62.   days = (pt->tm_yday +1) + ((pt->tm_hour + (pt->tm_min / 60.0)
  63. ***************
  64. *** 82,87 ****
  65. --- 102,115 ----
  66.         printf("Waning ");
  67.      printf("Crescent (%1.0f%% of Full)\n", phase);
  68.      }
  69. + #ifdef ST_MWC /* We want to hold the screen if invoked from the GEM desktop; */
  70. +            /* the desktop doesn't usually set any environment variables, */
  71. +            /* and if getenv() does find anything, it's probably empty */
  72. + if (((getenv("PATH")) == 0) || (strlen(getenv("PATH")) == 0)) {
  73. +      Cconws("press any key to continue: "); /* Hold screen if desktop */
  74. +      i = Crawcin(); /* Read raw character input */
  75. + }
  76. + #endif /* ST_MWC */
  77.   }
  78.   
  79.   double potm(days)
  80.